object dmData: TdmData
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  OnDestroy = DataModuleDestroy
  Height = 390
  Width = 666
  object MainDB: TpFIBDatabase
    DBName = 'D:\Projects\Data\Bin\BASE.FDB'
    DBParams.Strings = (
      'user_name=SYSDBA'
      'password=masterkey'
      'sql_role_name=NONE'
      'lc_ctype=UTF8')
    SQLDialect = 3
    Timeout = 0
    DesignDBOptions = [ddoIsDefaultDatabase, ddoStoreConnected]
    WaitForRestoreConnect = 0
    Left = 8
    Top = 16
  end
  object ibTransRead: TpFIBTransaction
    DefaultDatabase = MainDB
    Left = 72
    Top = 16
  end
  object IBTransWrite: TpFIBTransaction
    DefaultDatabase = MainDB
    TRParams.Strings = (
      'write'
      'nowait'
      'rec_version'
      'read_committed')
    TPBMode = tpbDefault
    Left = 144
    Top = 16
  end
  object qryObjList: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      ' Select o.ID, o.INN'
      ' from Objects o'
      ' Where (o.ISJUR = :jur) and (o.DELETED = :Del)')
    Left = 16
    Top = 72
  end
  object qryTmp_: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    Left = 216
    Top = 19
  end
  object qryUpdateObj: TpFIBQuery
    Transaction = IBTransWrite
    Database = MainDB
    SQL.Strings = (
      'UPDATE OBJECTS'
      'SET Deleted = :d'
      'WHERE ID = :i')
    Left = 216
    Top = 72
  end
  object qryUpdateField: TpFIBQuery
    Transaction = IBTransWrite
    Database = MainDB
    SQL.Strings = (
      
        'INSERT INTO commonfields (OBJID, FIELDID, Changed, VALSTR, UserI' +
        'd)'
      'Values (:oid, :fid, , :s, :uid)')
    Left = 504
    Top = 72
  end
  object qryObj: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    Left = 80
    Top = 72
  end
  object qryUsers: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      'Select * '
      'From Users')
    Left = 16
    Top = 144
  end
  object qryPhis: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      'Select o.INN'
      'From Objects o left join COMMONFIELDS c on o.ID = c.OBJID'
      'where (o.ID = :id) and (c.deleted = 0)'
      'sort by c.FDATE desc')
    Left = 280
    Top = 72
  end
  object qryObjFieldGet: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      
        'SELECT CF.CHANGED, CF.OBJID, CF.VALFLOAT, CF.VALID, CF.VALSTR, C' +
        'F.BLOBDATA'
      'FROM COMMONFIELDS CF'
      'WHERE (CF.DELETED = 0) AND'
      '      (CF.OBJID = :ID) AND'
      '      (CF.ORDNUM = :NUM) AND'
      '      (CF.FIELDID = :FID) AND'
      '      (CF.CHANGED <= :FDT)'
      'ORDER BY CF.CHANGED DESC ROWS 1')
    Left = 144
    Top = 72
  end
  object qryObjFieldSet: TpFIBQuery
    Transaction = IBTransWrite
    Database = MainDB
    SQL.Strings = (
      
        'Insert INTO COMMONFIELDS(OBJID, FIELDID, USERID, CHANGED, VALFLO' +
        'AT, VALID, VALSTR, BLOBDATA)'
      'Values( :aID, :FID, :uid, :aDATE, :vFloat, :vID, :vSTR, :blob)')
    Left = 344
    Top = 72
  end
  object spAddUser: TpFIBStoredProc
    Transaction = IBTransWrite
    Database = MainDB
    SQL.Strings = (
      'EXECUTE PROCEDURE ADDUSER (?L, ?P, ?A, ?C)')
    StoredProcName = 'ADDUSER'
    Left = 80
    Top = 144
  end
  object qryUserRights: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      'select'
      '    ACC.ID,'
      '    ACC.OBJECTID,'
      '    ACC.R_COMMONFIELDS,'
      '    ACC.R_REPRESENTERS,'
      '    ACC.R_DIRCOUNCIL,'
      '    ACC.R_SHARES,'
      '    u.LOGN,'
      '    u.ISADMIN,'
      '    u.CANSEEALL'
      'from'
      '    USERS u LEFT JOIN ACCESSRIGHTS ACC ON (u.ID = ACC.USERID)'
      '    Where (u.ID = :uid) and (ACC.OBJECTID = :oid)')
    Left = 146
    Top = 143
  end
  object qryWrite22: TpFIBQuery
    Transaction = IBTransWrite
    Database = MainDB
    MDTSQLExecutor = se_Server
    Left = 280
    Top = 20
  end
  object qryUpdateAcc: TpFIBQuery
    Transaction = IBTransWrite
    Database = MainDB
    Left = 224
    Top = 144
  end
  object qryRead: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    Left = 328
    Top = 20
  end
  object qryGetDocList: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      'Select'
      '    DOC.ID,'
      '    DOC.CHANGED,'
      '    DOC.DOCVAL,'
      '    DOC.FNAME,'
      '    DOC.DOCKIND,'
      '    DOC.OBJFIELD,'
      '    DOC.COMMENT,'
      '    F.ANAME as FieldName'
      '    --,F.DOCSCNT'
      'From'
      '    DOCS DOC'
      '    --Left JOIN FIELDSDEF F ON (DOC.OBJFIELD =  F.ID)'
      '    Left JOIN DOCSKIND F ON (DOC.OBJFIELD =  F.ID)'
      '    where'
      '    (DOC.OBJID = :oid) and (DOC.Deleted = :del)'
      '')
    Left = 24
    Top = 256
  end
  object qryGetDoc: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    Left = 96
    Top = 256
  end
  object dlgSelectDoc: TOpenDialog
    Filter = 
      'All Files|*.doc*;*.rtf;*.tif*;*.pdf;*.txt|TIFF files|*.tif*|MS W' +
      'ord files|*.doc*;*.rtf|Acrobat files|*.pdf|text file|*.txt'
    Left = 464
    Top = 12
  end
  object qryPriceByDate: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      ' SELECT SP.PRICE'
      ' FROM SHAREPRICE SP'
      ' WHERE (SP.DELETED = 0) AND (SP.OBJID = :ID)'
      ' AND (SP.SHKIND = :KIND) AND (SP.SHDATE <= :FDT)'
      ' ORDER BY SP.SHDATE DESC'
      ' ROWS 1')
    Left = 24
    Top = 304
  end
  object qryPriceHist: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      ' SELECT SP.PRICE, SP.SHDATE, SP.USERID, SP.USERID, U.LOGN'
      ' FROM SHAREPRICE SP LEFT JOIN USERS U ON U.ID = SP.USERID'
      ' WHERE (SP.DELETED = 0) AND (SP.OBJID = :ID)'
      ' AND (SP.SHKIND = :KIND)'
      ' ORDER BY SP.SHDATE DESC')
    Left = 96
    Top = 304
  end
  object qrySetShPrice: TpFIBQuery
    Transaction = ibTransRead
    Database = MainDB
    SQL.Strings = (
      
        '  UPDATE OR INSERT INTO SHAREPRICE (OBJID, SHDATE, PRICE, SHKIND' +
        ', DELETED, USERID)'
      '  VALUES (:oid, :adate, :aprice, :akind, 0, :uid)'
      '  MATCHING (OBJID, SHDATE, SHKIND)')
    Left = 168
    Top = 304
  end
  object ibServiceWrite: TpFIBTransaction
    DefaultDatabase = MainDB
    Left = 544
    Top = 8
  end
  object dlgOpenBase: TOpenDialog
    Title = #1059#1082#1072#1078#1080#1090#1077' '#1073#1072#1079#1091' '#1076#1072#1085#1085#1099#1093
    Left = 480
    Top = 160
  end
end
